namespace System
{
    public static class IComparableExtentions
    {
        public static int? Search<T>(this T[] Collection, int From, int To, T Item) where T : IComparable<T>
        {
            while(To >= From)
            {
                var middle = (From + To) / 2;

                var comp = Collection[middle].CompareTo(Item);
                if(comp > 0)
                    To = middle - 1;
                else if(comp < 0)
                    From = middle + 1;
                else
                    return middle;
            }

            return null;
        }
    }
}